/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package sg.edu.nus.iss.pacman.service.impl;

import sg.edu.nus.iss.pacman.dao.PacManDAO;
import sg.edu.nus.iss.pacman.dao.impl.PacManDAOImpl;
import sg.edu.nus.iss.pacman.service.Score;
import sg.edu.nus.iss.pacman.service.UserProfile;
import sg.edu.nus.iss.pacman.service.UserProfileService;

/**
 * Implementation of UserProfileService.
 * @author fredy
 */
public class UserProfileServiceImpl implements UserProfileService {

    public void addUserProfile(UserProfile userProfile) {
        PacManDAO dao = new PacManDAOImpl();

        // add user profile
        dao.addUserProfile(userProfile);

        //add score
        Score[] scores = userProfile.getScores();
        for (int i = 0; i < scores.length; i++) {
            dao.addScore(userProfile.getName(), scores[i].getScore(), scores[i].getMapName());
        }
    }
}
